
  	var verifyCode = new GVerify("LAY-user-get-vercode");//生成图形验证码
	layui.use(['form','layer','jquery'],function(){
		var form = layui.form,
		layer = layui.layer,
		$ = layui.$;
		
 	    //提交表单
 	    form.on('submit(LAY-user-forget-submit)',function(data){
 	    	//获取表单的值
 	    	var field = data.field,
 	    	email = field.email,						//邮箱
 	    	verificationCode = field.emailvercode,		//邮箱验证码
 	    	imgcode = field.imgvercode;      			//图形验证码
 	    	
 	       //校验图形验证码
				var res = verifyCode.validate(imgcode);
				if(!res){
					layer.msg('图形验证码错误',{icon:5});
					$('#LAY-user-login-vercode').val("");
					return false;
				}
			
			//发送请求
			$.ajax({
				type:"post",
				url:urlHead + "/user/verifyVerificationCodeByEmail",
				async:true,
				data:{
					"email":email,
					"verificationCode":verificationCode
				},
				success:function(res){
					console.log(res);
					if(res.code==0){
						location.href = "reset_password.html?email="+email;
					}else{
						layer.msg(res.msg,{icon:5});
					}
				},
				error:function(){
					layer.msg('找回密码失败',{icon:5});
				},
				dataType:"json"
			});
 	    	
 	    	return false;
 	    });
	});